package com.atguigu.tingshu.model.payment;

/**
 * PaymentTypeEnum 支付类型枚举类
 * @author Petrichor
 * @version 2024/01/10 19:26
 **/
public enum PaymentTypeEnum {
    /**
     * 订单枚举项，建立对应关系
    **/
    PAYMENT_TYPE_ORDER("1301","PAYMENT_TYPE_ORDER"),
    PAYMENT_TYPE_RECHARGE("1302","PAYMENT_TYPE_RECHARGE");
    /**
     * 支付类型 类型码
    **/
    private String paymentType;
    /**
     * 支付类型 名称
     **/
    private String paymentTypeName;

    private PaymentTypeEnum(String paymentType, String paymentTypeName) {
        this.paymentType = paymentType;
        this.paymentTypeName = paymentTypeName;
    }
    /**
     * @description: 定义获取订单状态名称的方法
     * @author Petrichor
     * @date 2024/1/10 19:28
     * @param paymentType 订单状态码
     * @return 订单状态名称
     **/
    public static String getPaymentTypeName(String paymentType) {
        // 获取当前所有枚举类的所有枚举项
        PaymentTypeEnum[] paymentTypeEnums = PaymentTypeEnum.values();
        for(PaymentTypeEnum paymentTypeEnum : paymentTypeEnums) {
            if(paymentTypeEnum.paymentType.equals(paymentType)) {
                return paymentTypeEnum.paymentTypeName ;
            }
        }
        return "" ;
    }

}

